#define BeepPORT PORTC
#define BeepDIR  DDRC
#define BeepPIN1 0x20
#define BeepPIN2 0x40

void beep_init(void)
{
 BeepDIR |= BeepPIN1+BeepPIN2;
 BeepPORT &= ~(BeepPIN1+BeepPIN2); 
}

void beep(char dlit,unsigned int ton)
{
  char n;
  unsigned int i;
  for(n=0;n<dlit;n++)
  {
    BeepPORT |= BeepPIN1;
    BeepPORT &= ~BeepPIN2;
    for(i=0;i<ton;i++){};
    BeepPORT |= BeepPIN2;
    BeepPORT &= ~BeepPIN1;
    for(i=0;i<ton;i++){};
  }
 BeepPORT &= ~(BeepPIN1+BeepPIN2);
}
